{extend name="public/base"/}
{block name="style"}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
{/block}
{block name="body"}
<div class="main-box no-header clearfix">
	<header class="main-box-header clearfix">
		<div class="pull-left">
			<h2>{$meta_title}</h2>
		</div>
		<div class="pull-right">
			<a class="btn btn-primary" href="{:url('add')}"><i class="fa fa-plus-circle fa-lg"></i> 新 增</a>
		</div>
	</header>
	<div class="main-box-body clearfix">
		<!-- 表格列表 -->
		<div class="table-responsive clearfix">
			<table class="table table-hover">
				<thead>
					<tr>
						<th width="30"><input class="checkbox check-all" type="checkbox"></th>
						<th width="60">ID</th>
						<th>名称</th>
						<th width="120">排序</th>
						<th width="120">发布</th>
						<th width="120">状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					{volist name="tree" id="list"}
					<tr>
						<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$list.id}"></td>
						<td>{$list['id']}</td>
						<td>
							{$list['level_show']}
							<a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="title" data-type="text" data-pk="{$list['id']}" data-url="{:url('editable')}">{$list['title']}</a>
							<a class="add-sub-cate" title="添加子分类" href="{:url('add?pid='.$list['id'])}">
								<i class="fa fa-plus-square"></i>
							</a>
						</td>
						<td><a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="sort" data-type="text" data-pk="{$list['id']}" data-url="{:url('editable')}">{$list['sort']}</a></td>
						<td>{$list['allow_publish']?'是':'否'}</td>
						<td>
							{if $list['status']}
							<span class="label label-primary">启用</span>
							{else/}
							<span class="label label-danger">禁用</span>
							{/if}
						</td>
						<td>
							<a title="编辑" href="{:url('edit?id='.$list['id'].'&pid='.$list['pid'])}">编辑</a>
							{if $list['status']}
							<a href="{:url('status?id='.$list['id'].'&status=0')}" class="ajax-get">禁用</a>
							{else/}
							<a href="{:url('status?id='.$list['id'].'&status=1')}" class="ajax-get">启用</a>
							{/if}
							<a title="删除" href="{:url('remove?id='.$list['id'])}" class="confirm ajax-get">删除</a>
							<a title="移动" href="{:url('operate?type=move&from='.$list['id'])}">移动</a>
							<a title="合并" href="{:url('operate?type=merge&from='.$list['id'])}">合并</a>
						</td>
					</tr>
					{/volist}
				</tbody>
			</table>
		</div>
		<!-- /表格列表 -->
	</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable.min.js"></script>
<script type="text/javascript">
$(function(){
	$.fn.editable.defaults.mode = 'popup';
	$.fn.editableform.buttons = '<button type="submit" class="btn btn-success editable-submit btn-mini"><i class="fa fa-check-square-o fa-white"></i></button>' +
	'<button type="button" class="btn editable-cancel btn-mini"><i class="fa fa-times"></i></button>';
	$('.editable').editable();
})
</script>
{/block}